/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.sun.courier.dal;

import com.sun.courier.entity.City;
import java.sql.ResultSet;
import java.util.ArrayList;

/**
 *
 * @author HONG QUAN
 */
public class CityDAL {
    DataAccessHelper dah = new DataAccessHelper();
    public ArrayList<City> getAllCity(){
        ArrayList<City> lst = new ArrayList<>();
        String strQuery = "Select * from City";
        try {
            ResultSet rs = dah.executeQuery(strQuery);
            while(rs.next()){
                City c = new City();
                c.setCityId(rs.getInt("CityId"));
                c.setCityName(rs.getString("CityName"));
                lst.add(c);
            }
        } catch (Exception e) {
        }
        return lst;
    }
    
}
